<script>

import store from "../../../store";
import UButton from "../../../uni_modules/uview-ui/components/u-button/u-button.vue";

export default {
  name: "index",
  components: {UButton},
  data() {
    return {
      iconSize: 34,
      list: [
        'https://cdn.uviewui.com/uview/swiper/swiper3.png',
        'https://cdn.uviewui.com/uview/swiper/swiper2.png',
        'https://cdn.uviewui.com/uview/swiper/swiper1.png',
      ],
      urls: {
        enter: '/pages/index/home/enter/index', // 信息录入
        install: '/pages/index/home/install/index', // 电站安装
        grid: '/pages/index/home/grid/index', // 电站并网
        design: '/pages/index/home/design/index', // 设计审核
        material: '/pages/index/home/material/index', // 物料管理
        acceptance: '/pages/index/home/acceptance/index', // 安装验收
        gridAcceptance: '/pages/index/home/grid-acceptance/index', // 并网验收
        documentation: '/pages/index/home/documentation/index', // 电站档案
        rectification: '/pages/index/home/rectification/index', // 整改管理
        query: '/pages/index/home/query/index', // 电站查询
        contract: '/pages/index/home/contract/index', // 合同签署
        add: '/pages/index/home/enter/edit/index', // 信息录入
      }
    }
  },
  computed: {
    token() {
      return store.state.user.token;
    }
  },
  methods: {
    click() {
      uni.showToast({
        title: '点击了',
        icon: 'none'
      })
    },
    toPage(url) {
      uni.navigateTo({
        url: url
      })
    },
  }
}
</script>

<template>
  <view class="home">
    <u-swiper
        :list="list"
    ></u-swiper>
    <view class="module">
      <view class="cell">
        <view class="line cell-hd" />
        <view class="name cell-bd">商业模式</view>
      </view>
      <view class="list">
        <u-button class="link-btn" color="#dab386" shape="circle" @click="toPage(urls.add)">纯租赁业务</u-button>
      </view>
    </view>
    <!--待处理信息-->
    <view class="module">
      <view class="cell">
        <view class="line cell-hd" />
        <view class="name cell-bd">待处理信息</view>
      </view>
      <view class="list">
        <u-grid
            :border="false"
            @click="click"
        >
          <u-grid-item @click="toPage(urls.enter)">
            <!--微标-->
            <!--<u-badge class="badge" type="warning" max="99" value="3"></u-badge>-->
            <u-icon
                name="file-text"
                :size="iconSize"
                color="#1396db"
            ></u-icon>
            <text class="grid-text">信息登记</text>
          </u-grid-item>
          <u-grid-item @click="toPage(urls.install)">
            <!--微标-->
            <!--<u-badge class="badge" type="warning" max="99" value="3"></u-badge>-->
            <u-icon
                name="file-text"
                color="#1396db"
                :size="iconSize"
            ></u-icon>
            <text class="grid-text">电站安装</text>
          </u-grid-item>
          <u-grid-item @click="toPage(urls.grid)">
            <!--微标-->
            <!--<u-badge class="badge" type="warning" max="99" value="3"></u-badge>-->
            <u-icon
                name="file-text"
                color="#1396db"
                :size="iconSize"
            ></u-icon>
            <text class="grid-text">电站并网</text>
          </u-grid-item>
        </u-grid>
      </view>
    </view>
    <!--安装阶段-->
    <view class="module">
      <view class="cell">
        <view class="line cell-hd" />
        <view class="name cell-bd">安装阶段</view>
      </view>
      <view class="list">
        <u-grid
            :border="false"
            @click="click"
        >
          <u-grid-item @click="toPage(urls.design)">
            <!--微标-->
            <!--<u-badge class="badge" type="warning" max="99" value="3"></u-badge>-->
            <u-icon
                name="file-text"
                :size="iconSize"
                color="#1396db"
            ></u-icon>
            <text class="grid-text">设计审核</text>
          </u-grid-item>
          <u-grid-item @click="toPage(urls.material)">
            <!--微标-->
            <!--<u-badge class="badge" type="warning" max="99" value="3"></u-badge>-->
            <u-icon
                name="file-text"
                color="#1396db"
                :size="iconSize"
            ></u-icon>
            <text class="grid-text">物料下单</text>
          </u-grid-item>
          <u-grid-item @click="toPage(urls.acceptance)">
            <!--微标-->
            <!--<u-badge class="badge" type="warning" max="99" value="3"></u-badge>-->
            <u-icon
                name="file-text"
                color="#1396db"
                :size="iconSize"
            ></u-icon>
            <text class="grid-text">安装验收</text>
          </u-grid-item>
        </u-grid>
      </view>
    </view>
    <!--并网阶段-->
    <view class="module">
      <view class="cell">
        <view class="line cell-hd" />
        <view class="name cell-bd">并网阶段</view>
      </view>
      <view class="list">
        <!--设置间距-->
        <u-grid
            :border="false"
            :col="3"
            @click="click"
        >
          <!--<u-grid-item @click="toPage(url)">-->
          <!--  &lt;!&ndash;微标&ndash;&gt;-->
          <!--  &lt;!&ndash;<u-badge class="badge" type="warning" max="99" value="3"></u-badge>&ndash;&gt;-->
          <!--  <u-icon-->
          <!--      name="file-text"-->
          <!--      :size="iconSize"-->
          <!--      color="#1396db"-->
          <!--  ></u-icon>-->
          <!--  <text class="grid-text">发票上传</text>-->
          <!--</u-grid-item>-->
          <!--<u-grid-item @click="toPage(urls.contract)">-->
          <!--  &lt;!&ndash;微标&ndash;&gt;-->
          <!--  &lt;!&ndash;<u-badge class="badge" type="warning" max="99" value="3"></u-badge>&ndash;&gt;-->
          <!--  <u-icon-->
          <!--      name="file-text"-->
          <!--      color="#1396db"-->
          <!--      :size="iconSize"-->
          <!--  ></u-icon>-->
          <!--  <text class="grid-text">合同签署</text>-->
          <!--</u-grid-item>-->
          <u-grid-item @click="toPage(urls.gridAcceptance)">
            <!--微标-->
            <!--<u-badge class="badge" type="warning" max="99" value="3"></u-badge>-->
            <u-icon
                name="file-text"
                color="#1396db"
                :size="iconSize"
            ></u-icon>
            <text class="grid-text">并网验收</text>
          </u-grid-item>
          <u-grid-item
              @click="toPage(urls.documentation)"
          >
            <!--微标-->
            <!--<u-badge class="badge" type="warning" max="99" value="3"></u-badge>-->
            <u-icon
                name="file-text"
                color="#1396db"
                :size="iconSize"
            ></u-icon>
            <text class="grid-text">项目归档</text>
          </u-grid-item>
          <u-grid-item
              @click="toPage(urls.query)"
          >
            <!--微标-->
            <!--<u-badge class="badge" type="warning" max="99" value="3"></u-badge>-->
            <u-icon
                name="file-text"
                color="#1396db"
                :size="iconSize"
            ></u-icon>
            <text class="grid-text">项目查询</text>
          </u-grid-item>
          <!--<u-grid-item-->
          <!--    :custom-style="'padding-top: 20px'"-->
          <!--    @click="toPage(urls.rectification)"-->
          <!--&gt;-->
          <!--  &lt;!&ndash;微标&ndash;&gt;-->
          <!--  &lt;!&ndash;<u-badge class="badge" type="warning" max="99" value="3"></u-badge>&ndash;&gt;-->
          <!--  <u-icon-->
          <!--      name="file-text"-->
          <!--      color="#1396db"-->
          <!--      :size="iconSize"-->
          <!--  ></u-icon>-->
          <!--  <text class="grid-text">电站整改</text>-->
          <!--</u-grid-item>-->
        </u-grid>
      </view>
    </view>
  </view>
</template>

<style scoped lang="scss">
.home{
  background: #f5f5f5;
  min-height: calc(100vh - 50px);
}
.module{
  padding: 15px 10px;
  background: #fff;
  margin-bottom: 10px;
  border-radius: 5px;
  margin-top: 10px;
  .name{
    line-height: 20px;
    font-size: 14px;
    padding-left: 8px;
  }
  .line{
    width: 4px;
    height: 15px;
    display: inline-block;
    background-color: #113d48;
    border-radius: 2px;
  }
  .list{
    margin-top: 20px;
    font-size: 12px;
    color: #555;
    .badge{
      position: absolute;
      right: -10px;
      top: 10px;
    }
    .item{
      margin-top: 20px;
    }
  }
}
.add-btn{
  height: 40px;
  line-height: 40px;
  padding: 0 20px;
  text-align: center;
  background: var(--sub-color);
  border-radius: 20px;
  margin: auto;
  font-size: 14px;
  color: #fff;
  letter-spacing: 2px;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}
.link-btn{
  width: 130px;
  letter-spacing: 2px;
}
</style>
